<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="css/iconfont.css">
    <link rel="stylesheet" href="css/global.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/styles.css">
    <script src="js/jquery.1.12.4.min.js" charset="UTF-8"></script>
    <script src="js/bootstrap.min.js" charset="UTF-8"></script>
    <script src="js/swiper.min.js" charset="UTF-8"></script>
    <script src="js/global.js" charset="UTF-8"></script>
    <script src="js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
    <title>U袋网</title>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            "url": "RequestServlet",                      // 要提交的URL路径
            "type": "post",                     // 发送请求的方式
            "data": "action=newsShowAction&op=newshow",                      // 要发送到服务器的数据
            "dataType": "json",
            "async": false,// 指定传输的数据格式
            "success": function (result) {
            }
        });
    });
</script>
<div class="tab-header">
    <div class="inner">
        <div class="pull-left">
            <div class="pull-left">
                嗨，欢迎来到<span class="cr">U袋网</span>
            </div>
            <a href="temp_article/udai_article4.jsp">帮助中心</a>
        </div>
        <div class="pull-right">
            <a href="ht_login.jsp"><span class="cr">登录</span> </a> <a
                href="ht_login.jsp">注销</a>
        </div>
    </div>
</div>

<!-- 顶部tab -->
<div class="bgf5 clearfix">
    <div class="top-user">
        <div class="inner">
            <a class="logo" href="index.jsp"><img
                    src="images/icons/logo.jpg" alt="U袋网" class="cover"> </a>
            <div class="title">U袋网后台管理界面</div>
        </div>
    </div>
</div>
<div class="content clearfix bgf5">
    <section class="user-center inner clearfix">
        <div class="pull-left bgf">
            <a href="udai_welcome.jsp" class="title">U袋欢迎页</a>
            <dl class="user-center__nav">
                <dt>个人信息</dt>
                <a href="udai_pwd_modify.jsp">
                    <dd>个人信息显示</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>员工管理</dt>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>员工入职</dd>
                </a>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>修改登陆密码</dd>
                </a>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>员工权限分配</dd>
                </a>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>员工离职</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>商品管理</dt>
                <a href="">
                    <dd>添加新商品</dd>
                </a>
                <a href="">
                    <dd>修改商品信息</dd>
                </a>
                <a href="">
                    <dd>商品上架</dd>
                </a>
                <a href="">
                    <dd>商品下架</dd>
                </a>
                <a href="">
                    <dd>查询商品信息</dd>
                </a>
                <a href="">
                    <dd>商品评论回复</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>前台订单管理</dt>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>查看订单</dd>
                </a>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>异常订单处理</dd>
                </a>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>修改订单配送信息</dd>
                </a>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>添加订单配送信息</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>分类管理</dt>
                <a href="RequestServlet?action=AdminCategoryAction&method=queryAll">
                    <dd>全部分类</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>我的购物车</dt>
                <a href="">
                    <dd>测试</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>新闻资讯管理</dt>
                <a href="ht_news_add.jsp">
                    <dd>添加新闻资讯</dd>
                </a>
                <a href="">
                    <dd>修改资讯状态</dd>
                </a>
                <a href="">
                    <dd>删除资讯信息</dd>
                </a>
                <a href="RequestServlet?action=newsShowAction&op=newsshow">
                    <dd class="active">查询资讯</dd>
                </a>
            </dl>
            <dl class="user-center__nav">
                <dt>管理日志查看</dt>
                <a href="RequestServlet?action=ShoppingCarAction&method=queryAll">
                    <dd>查看日志信息</dd>
                </a>
            </dl>
        </div>
        <div class="pull-right">
            <div class="user-content__box clearfix bgf">
                <div class="title">新闻资讯-新闻资讯信息查询</div>
                <form action="RequestServlet?action=newsShowAction&op=show" method="post" class="user-setting__form"
                      role="form">
                    <div class="form-group">
                        <span style="font-size:15px;font-weight:bold">新闻标题：</span><input type="text" name="newstitle"
                                                                                         placeholder="请输入文章标题名字"
                                                                                         size="15px"><br>
                        <span style="font-size:15px;font-weight:bold">发布时间：</span><input type="text" class="datepicker"
                                                                                         value="2019-01-01"
                                                                                         placeholder="请选择您的出生日期">
                    </div>
                    <script src="js/zebra.datepicker.min.js"></script>
                    <link rel="stylesheet" href="css/zebra.datepicker.css">
                    <script>
                        $('input.datepicker').Zebra_DatePicker({
                            default_position: 'below',
                            show_clear_date: false,
                            show_select_today: false,
                        });
                    </script>
                    <div class="user-form-group tags-box">
                        <button type="submit" class="btn ">提交</button>
                    </div>
                </form>

            </div>
            <div class="table-thead addr-thead">
                <div class="tdf1">资讯标题</div>
                <div class="tdf1">发布时间</div>
                <div class="tdf1">发布状态</div>
                <div class="tdf1">操作</div>
            </div>
            <div class="news-list">
                <c:forEach var="news" items="${pb.beanList}">
                    <dei class="addr-item">
                        <div class="tdf1 ">${news.title}</div>
                        <div class="tdf1 ">${news.date_in}</div>
                        <div class="tdf1 ">${news.open_in!=0?"已发布":"未发布"}</div>
                        <div class="tdf1 "><a href="RequestServlet?action=newsShowAction&op=oneNewsShow&newsid=${news.news_id}">查看</a>|<a>修改</a>|<a>删除</a></div>
                    </dei>
                </c:forEach>
                <div style="font-size: 15px;margin-left: 400px">
                    <a href="${pb.url}&pc=1">首页</a>
                    <c:if test="${pb.pc > 1 }">
                        <a href="${pb.url }&pc=${pb.pc-1}">上一页</a>
                    </c:if>

                    <%-- 计算begin、end --%>
                    <c:choose>
                        <%-- 如果总页数不足10页，那么把所有的页数都显示出来！ --%>
                        <c:when test="${pb.tp <= 7 }">
                            <c:set var="begin" value="1"/>
                            <c:set var="end" value="${pb.tp }"/>
                        </c:when>
                        <c:otherwise>
                            <%-- 当总页数>10时，通过公式计算出begin和end --%>
                            <c:set var="begin" value="${pb.pc-4 }"/>
                            <c:set var="end" value="${pb.pc + 4 }"/>
                            <%-- 头溢出 --%>
                            <c:if test="${begin < 1 }">
                                <c:set var="begin" value="1"/>
                                <c:set var="end" value="8"/>
                            </c:if>
                            <%-- 尾溢出 --%>
                            <c:if test="${end > pb.tp }">
                                <c:set var="begin" value="${pb.tp - 8 }"/>
                                <c:set var="end" value="${pb.tp }"/>
                            </c:if>
                        </c:otherwise>
                    </c:choose>
                    <%-- 循环遍历页码列表 --%>
                    <c:forEach var="i" begin="${begin}" end="${end }">
                        <c:choose>
                            <c:when test="${i eq pb.pc }">
                                <!--当前页不要超链接 -->
                                [${i}]
                            </c:when>
                            <c:otherwise>
                                <a href="${pb.url }&pc=${i}">[${i }]</a>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>


                    <!-- 首页共页上一页下页尾页 -->

                    <c:if test="${pb.pc < pb.tp }">
                        <a href="${pb.url }&pc=${pb.pc+1}">下一页</a>
                    </c:if>
                    <a href="${pb.url }&pc=${pb.tp}">尾页</a>
                    <h5>当前页: ${pb.pc} 总页数: ${pb.tp}</h5>
                </div>
            </div>
        </div>

    </section>
</div>
<!-- 右侧菜单 -->
<!-- 底部信息 -->


</body>
</html>